package com.jic.order.mapper;

import com.alibaba.fastjson.JSONObject;
import com.jic.order.entity.Order;
import com.jic.order.entity.OrderParent;
import com.jic.order.manage.request.OrderDistributionMemberRequest;
import com.jic.order.manage.request.OrderSaleReportRequest;
import com.jic.order.manage.response.OrderDistributionMembertResponse;
import com.jic.order.manage.response.OrderSaleReportResponse;
import com.jic.order.model.domain.OrderStatusCountModel;
import com.jic.order.model.entity.MOrderBale;
import com.jic.order.model.entity.MOrderGoods;
import com.jic.order.model.entity.MOrderPay;
import com.jic.order.response.OrderAllAmountResponse;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 订单父表
 *
 * @author : yinhaijun
 * @version : v1.0.0
 * @email :
 * @since : 2020-01-13 06:16:57
 */
@Mapper
public interface OrderParentMapper {

	long insert(OrderParent orderParent);

	long delete(Long id);

	long update(OrderParent orderParent);

	OrderParent queryByPrimaryKey(String parentOrderNo);

	List<OrderParent> query(OrderParent orderParent);

	List<OrderParent> queryOrderInfoByBuyId(OrderParent orderParent);

	List<OrderParent> queryPage(@Param("startIndex") int startIndex,
			@Param("limit") int limit,
			@Param("orderParent") OrderParent orderParent,
			@Param("orderStatusList") List<Integer> orderStatusList);

	long queryPageCount(OrderParent orderParent);

	List<OrderParent> queryOrderPage(@Param("startIndex") int startIndex, @Param("limit") int limit,
			@Param("buyerId") Long buyerId,
			@Param("parentOrderNo") String parentOrderNo,
			@Param("parentOrderNoList") List<String> parentOrderNoList,
			@Param("orderStatusList") List<Integer> orderStatusList);

	List<OrderAllAmountResponse> queryAllAmount(@Param("memberList") List<Long> memberId);

	/**
	 * 销售订单报表
	 *
	 * @param startIndex
	 * @param orderSaleReportRequest
	 * @return
	 */
	List<OrderSaleReportResponse> querySaleOrderReportPage(@Param("startIndex") int startIndex,
			@Param("order") OrderSaleReportRequest orderSaleReportRequest);

	long querySaleOrderReportPageCount(@Param("order") OrderSaleReportRequest orderSaleReportRequest);

	/**
	 * 代销员列表
	 *
	 * @param startIndex
	 * @param request
	 * @return
	 */
	List<OrderDistributionMembertResponse> queryOrderDistributionListPage(@Param("startIndex") int startIndex,
			@Param("orderDistribution") OrderDistributionMemberRequest request);

	long queryOrderDistributionListPageCount(@Param("orderDistribution") OrderDistributionMemberRequest request);

	/**
	 * 代销员详情
	 *
	 * @param startIndex
	 * @param request
	 * @return
	 */
	List<OrderDistributionMembertResponse> queryOrderDistributionInfoList(@Param("startIndex") int startIndex,
			@Param("orderDistributionInfo") OrderDistributionMemberRequest request);

	long queryOrderDistributionInfoListCount(@Param("orderDistributionInfo") OrderDistributionMemberRequest request);

	List<OrderParent> queryOrderInAfterSale();

	List<OrderStatusCountModel> queryMyAllOrderStatus(Long buyerId);

	OrderParent queryOrderParentInfo(@Param("order") Order order);

 	JSONObject queryOrderParentByOrderNo(@Param("parentOrderNo") String parentOrderNo);
	//确认收货
	boolean confirmReceipt(@Param("jdOrderId") String jdOrderId);

	//取消未确认订单
	boolean cancelUnconfirmedOrders(@Param("jdOrderId") String jdOrderId);

	//根据京东订单号获取主键id
	long getIdByJdOrderId(@Param("jdOrderId") String jdOrderId);

	List<JSONObject> querySettList(JSONObject jsonObject);

	Long queryGoodByOrderNo(@Param("orderParentNo") String orderParentNo);

	Integer updateSettlementStatus(JSONObject param);
}
